package entity;

public class Metrics {

	
	String fullname;

	//some metrics from the paper
	//need to re-consider the noi
	
	int nof; // number of fields
	int nsf; // number of static fields
	int noof; // number of object fields
	int ncof; // number of other classes with field of own type
	
	int nom; // number of methods
	int nsm; // number of static methods
	int noam; // number of abstract methods
	int norm; // number of overridden methods;
	int nopm; // number of public methods;
		
	int noi; // number of interface
	int nos; // number of subtypes (add by myself)
	
	int notc; // number of constructors with argument of object type
	
	int nodr; //number of acting as delegator
	int node; // number of acting as delegatee
	
	//want separate metrics for extends and implements, and the total 
	
	//some boolean metrics
	boolean isAbstract;
	boolean isInterface;
	
	//unused metrics
	int nopc; // number of private constructors;
	int nmgi;// number of methods to generate instances
	

	public Metrics(){
		//set default values
		nof  = 0;
		nsf  = 0;
		
		nom  = 0;
		nsm  = 0;
		noam = 0;
		norm = 0;
		nopm = 0;
		
		noi  = 0;		
		
		notc = 0;
		noof = 0;
		ncof = 0;
				
		nos  = 0;
		nodr = 0;
		node = 0;
		
		isAbstract = false;
		isInterface = false;
		
//		nmgi = 0;
//		nopc = 0;
	}
	
	
	public String toString(){
		StringBuilder sb  = new StringBuilder();
		sb.append("name: "+fullname+"\n");
		sb.append("  number of fields: "+nof+"\n");
		sb.append("  number of static fields: "+nsf+"\n");
		sb.append("  number of methods: "+nom+"\n");
		sb.append("  number of static methods: "+nsm+"\n");
		sb.append("  number of interfaces: "+noi+"\n");
		sb.append("  number of abstract methods: "+noam+"\n");
		sb.append("  number of overriden methods: "+norm+"\n");
		sb.append("  number of object field: "+noof+"\n");
		sb.append("  number of other classes with field of own type: "+ncof+"\n");
		sb.append("  number of subtypes: " + nos + "\n");
		sb.append("  number of acting as delegator: " + nodr + "\n");
		sb.append("  number of acting as delegatee: " + node + "\n");
		sb.append("  number of constructors with object type: " + notc + "\n");
		return sb.toString();
	}
	
	public String toCSV(){
		StringBuilder sb  = new StringBuilder();
		sb.append(fullname+",");
		sb.append(nof+",");
		//sb.append(nsf+",");
		sb.append(nom+",");
		sb.append(nsm+",");
		sb.append(noi+",");
		sb.append(noam+",");
		sb.append(norm+",");
		sb.append(noof+",");
		sb.append(ncof+",");
		sb.append(nos+",");
		sb.append(nodr+",");
		sb.append(node+"\n");
		
		return sb.toString();
	}
	
	public String toCSVWithoutClassNames(){
		StringBuilder sb  = new StringBuilder();
		
		sb.append(nof+",");
		sb.append(nsf+",");
		sb.append(nom+",");
		sb.append(nsm+",");
		sb.append(noi+",");
		sb.append(noam+",");
		sb.append(norm+",");
		sb.append(noof+",");
		sb.append(ncof+",");
		sb.append(nos+",");
		sb.append(nodr+",");
		sb.append(node+",");
		return sb.toString();
	}
	
	public String getHeader(){
		StringBuilder sb  = new StringBuilder();
		
		sb.append(nof+",");
		//sb.append(nsf+",");
		sb.append(nom+",");
		sb.append(nsm+",");
		sb.append(noi+",");
		sb.append(noam+",");
		sb.append(norm+",");
		sb.append(noof+",");
		sb.append(ncof+",");
		sb.append(nos+",");
		sb.append(nodr+",");
		sb.append(node+",");
		return sb.toString();
	}
	
	
	public String getFullname() {
		return fullname;
	}
	public void setFullname(String fullname) {
		this.fullname = fullname;
	}
	public int getNof() {
		return nof;
	}
	public void setNof(int nof) {
		this.nof = nof;
	}
	public int getNsf() {
		return nsf;
	}
	public void setNsf(int nsf) {
		this.nsf = nsf;
	}
	public int getNom() {
		return nom;
	}
	public void setNom(int nom) {
		this.nom = nom;
	}
	public int getNsm() {
		return nsm;
	}
	public void setNsm(int nsm) {
		this.nsm = nsm;
	}
	public int getNoi() {
		return noi;
	}
	public void setNoi(int noi) {
		this.noi = noi;
	}
	public int getNoam() {
		return noam;
	}
	public void setNoam(int noam) {
		this.noam = noam;
	}
	public int getNorm() {
		return norm;
	}
	public void setNorm(int norm) {
		this.norm = norm;
	}
	public int getNopm() {
		return nopm;
	}
	public void setNopm(int nopm) {
		this.nopm = nopm;
	}
	public int getNopc() {
		return nopc;
	}
	public void setNopc(int nopc) {
		this.nopc = nopc;
	}
	public int getNotc() {
		return notc;
	}
	public void setNotc(int notc) {
		this.notc = notc;
	}
	public int getNoof() {
		return noof;
	}
	public void setNoof(int noof) {
		this.noof = noof;
	}
	public int getNcof() {
		return ncof;
	}
	public void setNcof(int ncof) {
		this.ncof = ncof;
	}
	public void addNcof(){
		this.ncof ++;
	}
	public int getNmgi() {
		return nmgi;
	}
	public void setNmgi(int nmgi) {
		this.nmgi = nmgi;
	}

	public int getNos() {
		return nos;
	}

	public void setNos(int nos) {
		this.nos = nos;
	}
	
	public void addNos(){
		this.nos ++;
	}

	public int getNodr() {
		return nodr;
	}

	public void setNodr(int nodr) {
		this.nodr = nodr;
	}
	
	public void addNodr(){
		this.nodr++;
	}

	public int getNode() {
		return node;
	}

	public void setNode(int node) {
		this.node = node;
	}
	public void addNode(){
		this.node++;
	}	
	public boolean isAbstract() {
		return isAbstract;
	}

	public void setAbstract(boolean isAbstract) {
		this.isAbstract = isAbstract;
	}

	public boolean isInterface() {
		return isInterface;
	}

	public void setInterface(boolean isInterface) {
		this.isInterface = isInterface;
	}
	
	
	
	
	
	
}
